package com.whu.exp1jsp.util;

import java.sql.Connection;

public class DBUtil {
    public static final String DRIVER = "com.mysql.cj.jdbc.Driver";
    public static final String URL = "jdbc:mysql://www.yym-free.com:3306/web_exp";
    public static final String USER = "web_exp";
    public static final String PASSWORD = "web_exp";

    public static Connection getConnection() {
        Connection conn;
        try {
            Class.forName(DRIVER).newInstance();
            conn = java.sql.DriverManager.getConnection(URL, USER, PASSWORD);
            return conn;
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("数据库连接失败");
            return null;
        }

    }

}
